import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [

  {
    title: '客户名称',
    align:"center",
    dataIndex: 'customerName',
    width:170
  },
   {
    title: '旺店通名称',
    align:"center",
    dataIndex: 'fenxiaoNick',
    width:200
  },
  // {
  //   title: '旺店通编号',
  //   align:"center",
  //   dataIndex: 'distributorCode'
  // },
  {
    title: '区域',
    align:"center",
    dataIndex: 'regionId',
  },
  {
    title: '客户负责人',
    align:"center",
    dataIndex: 'contactName'
  },
   {
    title: '授权渠道',
    align:"center",
    dataIndex: 'authChannel'
  },
  {
    title: '行业',
    align:"center",
    dataIndex: 'industry_dictText'
  },
      {
    title: '保证金',
    align:"center",
    dataIndex: 'deposit'
  },
    {
    title: '授权企业',
    align:"center",
    dataIndex: 'authCompany'
  },
    {
    title: '合作形式',
    align:"center",
    dataIndex: 'cooperationType'
  },
    {
    title: '合作资料',
    align:"center",
    dataIndex: 'cooperationDocs',
    customRender:render.renderImage,
  },
    {
    title: '回款方式',
    align:"center",
    dataIndex: 'paymentAccount'
  },
  // {
  //   title: '负责人手机号',
  //   align:"center",
  //   dataIndex: 'contactPhone'
  // },
  // {
  //   title: '负责人微信号',
  //   align:"center",
  //   dataIndex: 'wechatId'
  // },
  {
    title: '合作状态',
    align:"center",
    dataIndex: 'status_dictText'
  },
  {
    title: '合作开始日期',
    align:"center",
    dataIndex: 'cooperationDate',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
  },
    {
    title: '合作结束日期',
    align:"center",
    dataIndex: 'cooperationDateEnd',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
  },
    {
    title: '合作期限',
    align:"center",
    dataIndex: 'cooperationDuringDate'
  },
  {
    title: '对接人员',
    align:"center",
    dataIndex: 'salesPersonId_dictText'
  },
  // {
  //   title: '对接职位',
  //   align:"center",
  //   dataIndex: 'salesPositionId_dictText'
  // },
  // {
  //   title: '是否存在合同',
  //   align:"center",
  //   dataIndex: 'isContract_dictText'
  // },
  // {
  //   title: '是否本周新增',
  //   align:"center",
  //   dataIndex: 'isNewWeek_dictText'
  // },
  // {
  //   title: '是否新用户',
  //   align:"center",
  //   dataIndex: 'isNew_dictText'
  // },
    {
    title: '创建日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新日期',
    align:"center",
    dataIndex: 'updateTime'
  },
];

//子表列表数据
export const customerFollowupColumns: BasicColumn[] = [

  {
    title: '客户名称',
    align:"center",
    dataIndex: 'customerName'
  },
  {
    title: '跟进原因',
    align:"center",
    dataIndex: 'reason'
  },
  {
    title: '商机情况/对方反应等',
    align:"center",
    dataIndex: 'opportunity'
  },
  {
    title: '跟进形式',
    align:"center",
    dataIndex: 'followupType'
  },
  {
    title: '跟进销售人员',
    align:"center",
    dataIndex: 'salesPersonId_dictText'
  },
  {
    title: '跟进时间',
    align:"center",
    dataIndex: 'followupTime'
  },
  {
    title: '跟进内容说明',
    align:"center",
    dataIndex: 'content'
  },
  {
    title: '证据图片',
    align:"center",
    dataIndex: 'evidenceUrl',
    customRender:render.renderImage,
  },
    {
    title: '创建日期',
    align:"center",
    dataIndex: 'createTime'
  },
  {
    title: '更新日期',
    align:"center",
    dataIndex: 'updateTime'
  },
];
//子表列表数据
export const contractColumns: BasicColumn[] = [
  {
    title: '合同编号',
    align:"center",
    dataIndex: 'contractCode'
  },
  {
    title: '合同名称',
    align:"center",
    dataIndex: 'contractName'
  },
  {
    title: '合同金额',
    align:"center",
    dataIndex: 'amount'
  },
  {
    title: '签约日期',
    align:"center",
    dataIndex: 'signDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '对接销售人员',
    align:"center",
    dataIndex: 'salesPersonId_dictText'
  },
  {
    title: '合同重点内容',
    align:"center",
    dataIndex: 'content'
  },
  {
    title: '合同录入人员',
    align:"center",
    dataIndex: 'recorder_dictText'
  },
  {
    title: '合同附件路径',
    align:"center",
    dataIndex: 'attachmentUrl',
  },
  {
    title: '客户',
    align:"center",
    dataIndex: 'customerId_dictText'
  },
  {
    title: '是否本周新增',
    align:"center",
    dataIndex: 'isNewWeek_dictText'
  },
];

// 高级查询数据
export const superQuerySchema = {
  createTime: {title: '创建日期',order: 0,view: 'datetime', type: 'string',},
  updateTime: {title: '更新日期',order: 1,view: 'datetime', type: 'string',},
  customerName: {title: '客户名称',order: 2,view: 'text', type: 'string',},
  distributorCode: {title: '旺店通分销商编号',order: 3,view: 'text', type: 'string',},
  regionId: {title: '客户区域位置',order: 4,view: 'pca', type: 'string',},
  contactName: {title: '客户负责人姓名',order: 5,view: 'text', type: 'string',},
  contactPhone: {title: '负责人手机号',order: 6,view: 'text', type: 'string',},
  wechatId: {title: '负责人微信号',order: 7,view: 'text', type: 'string',},
  status: {title: '合作状态',order: 8,view: 'number', type: 'number',dictCode: 'cooperation_status',},
  cooperationDate: {title: '合作日期',order: 9,view: 'date', type: 'string',},
  industry: {title: '行业',order: 10,view: 'list', type: 'string',dictCode: 'industry',},
  authChannel: {title: '客户授权渠道',order: 11,view: 'text', type: 'string',},
  salesPersonId: {title: '对接销售人员',order: 12,view: 'sel_search', type: 'string',dictTable: "f_sales_person", dictCode: 'id', dictText: 'name',},
  salesPositionId: {title: '对接职位',order: 13,view: 'text', type: 'string',},
  isNewWeek: {title: '是否本周新增',order: 14,view: 'number', type: 'number',dictCode: 'yn',},
};
